package utils.independent;

import java.io.File;

import swissmap.Constants;

/**
 * find start and end rows and colums that contain map data
 * @author TIG
 *
 */
public class FindMapDimensions {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String curres="25k";
		
		
		boolean colempty=true;
		for(int col=0;col<Constants.dimx_end.get(curres);col++){
			for(int row=0;row<Constants.dimy_end.get(curres);row++){	
				File f=new File(Constants.basePath+"raw"+File.separator+curres+File.separator+Constants.intoToString(col)+File.separator+Constants.intoToString(row)+".jpeg");

				if(f.exists()){
					if(f.length()>2000 && colempty){
						colempty=false;
						break;
					}
				}else{
					System.out.println(f.getAbsolutePath()+ " missing");
				}
			}
			if(colempty)
				System.out.println("Column: "+col+" empty");
		}
		
		boolean rowempty=true;	
		for(int row=0;row<Constants.dimy_end.get(curres);row++){	
			for(int col=0;col<Constants.dimx_end.get(curres);col++){
				File f=new File(Constants.basePath+"raw"+File.separator+curres+File.separator+Constants.intoToString(col)+File.separator+Constants.intoToString(row)+".jpeg");
				if(f.exists()){
					if(f.length()>2000 && rowempty){
						rowempty=false;
						break;
					}
				}else{
					System.out.println(f.getAbsolutePath()+ " missing");
				}
					
			}
			if(rowempty)
				System.out.println("Row: "+row+" empty");
		}
	}

}
